package net.zdreamer.shunyi.ui.fragment;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import net.zdreamer.shunyi.R;
import net.zdreamer.shunyi.ui.login.LogInActivity;
import net.zdreamer.shunyi.ui.myinfo.MyBanghuiActivity;


public class MyInfoFragment extends Fragment implements View.OnClickListener {
    private RelativeLayout titlelayout;
    private TextView titlecontent, Login;
    private ImageView rightimag, mybanghui;

    private Intent intent;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_my_info, container, false);
    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

    }

    @Override
    public void onStart() {
        super.onStart();
        initview();

    }

    private void initview() {
        titlelayout = (RelativeLayout) getView().findViewById(R.id.title_item);
        titlecontent = (TextView) getView().findViewById(R.id.title_content);
        rightimag = (ImageView) getView().findViewById(R.id.right_image);
        titlelayout.setBackgroundResource(R.drawable.newsbiaoti);
        rightimag.setImageResource(R.drawable.setting);
        titlecontent.setText("游客");
        titlecontent.setTextColor(getResources().getColor(R.color.white));

        Login = (TextView) getView().findViewById(R.id.Login);
        Login.setOnClickListener(this);

        mybanghui = (ImageView) getView().findViewById(R.id.mybanghui);
        mybanghui.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.Login:
                intent = new Intent(getActivity(), LogInActivity.class);
                startActivity(intent);
                break;
            case R.id.mybanghui:
                intent = new Intent(getActivity(), MyBanghuiActivity.class);
                startActivity(intent);
                break;
            default:
                break;
        }
    }
}
